/**
 * sdk管理类
 * - 仅定义接口，调用各平台 sdk
 * @author 神兽白泽
 * @description 交流群：415468592
 */

import { _decorator, sys } from 'cc';
import * as cc from 'cc';
import SdkBase from "./SdkBase";
import WXMiniSdk from "./wxMiniGame/WXMiniSdk";
import Native from "./native/Native";
enum PLATFORM {
    wx_mini_game = 0,
    android = sys.Platform.ANDROID,//sys.platform == sys.ANDROID
}
export default class SdkMgr {
    /** 当前平台 */
    private static platform: number = 1;
    /** 当前sdk平台 */
    private static cur_sdk: typeof SdkBase = null;

    /**
    * 平台初始化
    */
    public static init() {
        this.platform = 0;
        if (cc.sys.isNative) {// 原生
            this.cur_sdk = Native;
        } else if (this.platform == PLATFORM.wx_mini_game) {// 微信小游戏
            this.cur_sdk = WXMiniSdk;
        } else {

        }
        if (this.cur_sdk.init) this.cur_sdk.init();
        console.log("当前sdk: " + this.cur_sdk.name);
    }

    /**
    * 微信朋友圈分享
    */
    public static wxPYQShare() {
        this.cur_sdk.wxPYQShare();
    }

    /**
    * 微信朋友圈分享
    */
    public static weChatShare() {
        this.cur_sdk.weChatShare();
    }
}
SdkMgr.init();